var express =require('express');
var app = express();
var proxy = require('http-proxy-middleware');




app.use(express.static('./dist'));

app.use(function(req,res,next){
	console.log(req.originalUrl,req.method)

	next();
})
app.use('/', proxy({
    //target:'http://api.csbr.cn/',
    target:'http://192.168.3.203:8082/',
    changeOrigin: true,
    pathRewrite: {
        //'^/apiserver':'/'
        '^/':'/'
    }
}));
app.get('/delete',function(req,res){
	res.send('{"errorCode":0}')
})
app.post('/save',function(req,res){
	res.send('{"errorCode":0}')
})

var server = app.listen(3030, function () {
  var host = server.address().address;
  var port = server.address().port;

  console.log('Example app listening at http://%s:%s', host, port);
});